package com.drugstore.drugstore.controller;

import java.util.List;

import com.drugstore.drugstore.domain.Employee;
import com.drugstore.drugstore.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * Controller
 * 
 * @author 
 * @date 2025-05-08
 */
@RestController
@RequestMapping("/system/employee")
public class EmployeeController 
{
    @Autowired
    private IEmployeeService employeeService;

    /**
     * 查询列表
     */
    @CrossOrigin
    @GetMapping("/list")
    public List<Employee> list(Employee employee)
    {

        return employeeService.selectEmployeeList(employee);
    }

  
    /**
     * 获取详细信息
     */
    @CrossOrigin
    @GetMapping(value = "/{id}")
    public Employee getInfo(@PathVariable("id") Long id)
    {
        return employeeService.selectEmployeeById(id);
    }

    /**
     * 新增
     */

    @CrossOrigin
    @PostMapping
    public int add(@RequestBody Employee employee)
    {
        return employeeService.insertEmployee(employee);
    }

    /**
     * 修改
     */

    @CrossOrigin
    @PutMapping
    public int edit(@RequestBody Employee employee)
    {
        return employeeService.updateEmployee(employee);
    }

    /**
     * 删除
     */
    @CrossOrigin
	@DeleteMapping("/{ids}")
    public int remove(@PathVariable Long[] ids)
    {
        return employeeService.deleteEmployeeByIds(ids);
    }
}
